use core::ops::Deref;

use stm32f4::stm32f407::{self, adc1, adc2, adc3, adc_common};



pub struct ADC1;
pub struct ADC2;
pub struct ADC3;

pub struct ADC;

impl Deref for ADC {
    type Target = adc_common::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*stm32f407::ADC_COMMON::PTR }
    }
}

impl Deref for ADC1 {
    type Target = adc1::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*stm32f407::ADC1::PTR }
    }
}

impl Deref for ADC2 {
    type Target = adc2::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*stm32f407::ADC2::PTR }
    }
}

impl Deref for ADC3 {
    type Target = adc3::RegisterBlock;
    fn deref(&self) -> &Self::Target {
        unsafe { &*stm32f407::ADC3::PTR }
    }
}

pub fn adc_global_init() {
    ADC.ccr.write(|w| w.adcpre().div8());
}




